﻿<phone:PhoneApplicationPage
    x:Class="DueDatePickerSample.Controls.DueDatePickerPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:converters="clr-namespace:DueDatePickerSample.Converters"
    SupportedOrientations="Portrait" Orientation="Portrait"
    Name="DueDatePickerPageName">
    
    <phone:PhoneApplicationPage.Resources>
        <converters:DueDateToNameConverter x:Key="DueDateToNameConverter" />
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!-- SystemTray placeholder -->
        <Rectangle Grid.Row="0" Height="32" />

        <!-- Title -->
        <TextBlock Grid.Row="1"
                   Text="DUE DATE"
                   FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                   FontSize="{StaticResource PhoneFontSizeMedium}"
                   Foreground="{StaticResource PhoneForegroundBrush}"
                   Margin="24,16,24,24" />

        <!-- List of Items -->
        <ListBox Grid.Row="2"
                 ItemsSource="{Binding ElementName=DueDatePickerPageName, Path=DueDateValues}"
                 SelectedItem="{Binding ElementName=DueDatePickerPageName, Path=SelectedItem, Mode=TwoWay}"
                 Margin="24 12 0 0" 
                 FontSize="43" 
                 FontFamily="{StaticResource PhoneFontFamilyLight}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Converter={StaticResource DueDateToNameConverter}}"
                               Tap="OnListItemTapped"
                               Margin="0 10" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

</phone:PhoneApplicationPage>